import java.util.ArrayList;
import java.util.HashSet;
import java.util.Date;



public class TestPathFinding {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		int[][] x= {{1,1,1,1,1,1,1,1,1,1},
					{1,0,0,0,0,0,0,1,0,1},
					{1,0,0,0,0,0,0,1,0,1},
					{1,0,0,0,0,0,0,1,0,1},
					{1,0,0,0,0,0,0,1,0,1},
					{1,0,0,0,0,1,0,1,0,1},
					{1,0,0,0,0,1,0,1,0,1},
					{1,0,0,0,0,1,0,0,0,1},
					{1,1,1,1,1,1,1,1,1,1}};		

		Board board = new Board(9, 10);
		for (int i=0; i<board.getNumRows();i++){
			for (int j=0;j<board.getNumColumns();j++){
				if(x[i][j]==0)
					board.setData(i, j, Board.EMPTY);
				if(x[i][j]==1)
					board.setData(i, j, Board.WALL);
			}
		}
		
		System.out.println(board.toString());
	
		Position initalPlayerPos = new Position(4, 4);
		ArrayList<Position> v = new ArrayList<Position>();
//		Position b1 = new Position(3,2);
//		Position b2 = new Position(3,3);
//		Position b3 = new Position(2,2);
		Position b4 = new Position(3,4);
//		Position b5 = new Position(3,5);
//		Position b6 = new Position(2,4);
//		Position b7 = new Position(4,2);
//		v.add(b1);
//		v.add(b2);
//		v.add(b3);
		v.add(b4);
//		v.add(b5);
//		v.add(b6);
//		v.add(b7);
//	
		PlayerNBoxes pnb = new PlayerNBoxes(initalPlayerPos, v);
		Position goalPos = new Position(1,8);
		//PathFinding.isPathTo(goalPos, pnb, board);
		
		Date s = new Date();
		String path="";
		for(int a=0; a<100; a++){
			path= PathFinding.pathTo(goalPos, pnb, board);			
		}
		System.out.println(path);
		Date e= new Date();
		System.out.println(e.getTime()-s.getTime());
		
//		s = new Date();
//		path="";
//		for(int a=0; a<1000000; a++){
//			path= PathFinding2.pathTo(goalPos, pnb, board);			
//		}
//		System.out.println(path);
//		e= new Date();
//		System.out.println(e.getTime()-s.getTime());
//		
		
////		PathFinding.simplifyPath(path);
////		System.out.println(path);
		
		
//		PlayerNBoxes pnb2 = new PlayerNBoxes(pnb.getPlayer(), v);
//		pnb2.setPlayer(b1);
//		System.out.println(pnb.getPlayer().toString() + "" + pnb2.getPlayer().toString());
//		
		
		//////////Test String
//		String s = "abcdefghijkl";
//		String a = "abcde";
//		String b = "g";
//		String result = s.replace(a, b);
//		System.out.println(result);
//		System.out.println(s.toUpperCase());
//		System.out.println("abc".toUpperCase());
		
		
		//TEST FinalPosition
		/*
		Position c1 = new Position(3,5);
		Position c2 = new Position(2,5);
		Position c3 = new Position(2,6);
		Position c4 = new Position(1,6);
		ArrayList<Move> moves = new ArrayList<Move>();
		Move m1 = new Move(b4, c1);
		moves.add(m1);
		Move m2 = new Move(c1, c2);
		moves.add(m2);
		Move m3 = new Move(c2, c3);
		moves.add(m3);
		Move m4 = new Move(c3, c4);
		moves.add(m4);
		
		Date s = new Date();
		for(int a=0; a<1; a++){
			System.out.println(PathFinding2.finalPath2(moves, board, pnb));
		}
		Date e= new Date();
		System.out.println(e.getTime()-s.getTime());
	*/
	}

	

}
